<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLocalidad extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('localidad', function (Blueprint $table) {
            $table->increments('id_localidad');
            $table->string('nombre',50);
            $table->integer('num_habitantes')->nullable();
            $table->integer('id_dep');
            $table->date('fec_fundacion')->nullable();
            $table->string('descr',70)->nullable();
            $table->float('latitud');
            $table->float('longitud');
            $table->integer('id_area')->nullable();
            
            //            $table->primary('id_localidad');
            $table->foreign('id_dep')->references('id_departamento')->on('departamento');
            $table->foreign('id_area')->references('id_area')->on('area');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('localidad');
    }
}
